/**
 * 
 */
package it.unical.canonaco.rende.igpe.game.cbv.guilayer.components;

import it.unical.canonaco.rende.igpe.game.cbv.guilayer.sprites.SpriteSheetCache;
import it.unical.canonaco.rende.igpe.game.cbv.guilayer.sprites.SpriteSheetInterface;
import it.unical.canonaco.rende.igpe.game.cbv.guilayer.sprites.key.AbstractSheetKey;
import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.component.pawn.GenericPawn;
import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.component.world.Chessboard;
import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.component.world.TextureInfoBean;
import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.events.EventListener;
import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.events.EventManager;
import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.events.GenericEvent;
import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.events.InvalidPointSettingEvent;
import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.exceptions.InvalidFileException;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.util.HashMap;

/**
 * @author Massimo Canonaco
 *
 */
public abstract class AbstractPainterManager implements EventListener
{
	protected SpriteSheetCache spritesCache;
	
	protected String textureFolder;
	
	public AbstractPainterManager(SpriteSheetCache cache, final String texturePath, final String errorImgPath)
	{
		textureFolder = texturePath;
//		spritesCache = new SpriteSheetCache(rolePath, new HashMap<AbstractSheetKey,SpriteSheetInterface>());
		spritesCache = cache;
	}
	
	public void setting(EventManager eventManager)
	{
		eventManager.addListener(this, new InvalidPointSettingEvent(false));
	}
	
	public void dispose()
	{
		EventManager.getInstance().removeListener(this, new InvalidPointSettingEvent(false));
	}
	abstract public void coordinates(int wildX, int wildY, int tile, Point storage);
	abstract public void paintClickPoint(int wildX, int wildY, int tile, float opacity, Graphics2D graphics) throws InvalidFileException;
	abstract public void paintPawn(GenericPawn pawn, int tile, Graphics2D graphics) throws InvalidFileException ;
	abstract public void paintPawn(GenericPawn pawn, int wildX, int wildY, int tile, Graphics2D graphics) throws InvalidFileException ;
	abstract public void paintColoredCell(int row, int colum, int tile, float opacity, Color color, Graphics2D graphics) throws InvalidFileException ;
	abstract public void paintTexturedCell(int row, int column, int tile, TextureInfoBean textureBean, Graphics2D graphics) throws InvalidFileException ;
	abstract public void paintScene(int tile, Chessboard board, Graphics2D graphics) throws InvalidFileException ;
	abstract public void updateStatus();
}
